'''
模块添加
'''
from selenium.webdriver.common.by import By
from page.base_page import BasePage

class Moban(BasePage):
    url = 'http://192.168.1.25/crm/index.php?m=sms&a=index'

    # 点击添加短信模板
    dianjitjdx__locator = (By.CSS_SELECTOR, '#add')
    # 输入标题
    shurubiaoti_locator = (
    By.CSS_SELECTOR, '#dialog-add > form > table > tbody > tr:nth-child(2) > td:nth-child(2) > input')
    # 输入内容
    shuruneirong_locator = (By.CSS_SELECTOR, '#content')
    # 点击保存
    baocun_locator = (By.CSS_SELECTOR, '#dialog-add > form > table > tfoot > tr > td > input.btn.btn-primary')
    # 取消
    quxioa_locator = (By.CSS_SELECTOR, '#dialog-add > form > table > tfoot > tr > td > input:nth-child(2)')

    def dianjiduanxingmoban(self):
        self.driver.find_element(*self.dianjitjdx__locator).click()

    def shurubiaoti(self,biaoti):
        self.driver.find_element(*self.shurubiaoti_locator).send_keys(biaoti)

    def shuruneirong(self,nr):
        self.driver.find_element(*self.shuruneirong_locator).send_keys(nr)

    def dianjibaocun(self):
        self.driver.find_element(*self.baocun_locator).click()

    def quxiao(self):
        self.driver.find_element(*self.quxioa_locator).click()

    # 获取页面url
    def get_url(self):
            url = self.driver.current_url
            return url